{extend name='admin@public/content'}

{block name="button"}
<button data-open='{:url("$classuri/")}' data-title="返回列表" class='layui-btn layui-btn-sm layui-btn-primary'><i class='fa fa-arrow-left'></i> 返回列表</button>
{/block}

{block name='content'}

<!--右侧编辑区 开始-->
<div class="panel panel-default article-right" style="overflow:hidden;width: 96rem;">
    <div class="panel-body">
        <form class="form-horizontal" action="{:url()}" data-auto="true" method="post">
            <input type="hidden" name="id" value='{$vo.id|default=""}'>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询师名称</span>
                        <input class="layui-input rw60" maxlength="200" required="required"  name="name" value="{$vo.name|default=''}" title="咨询师名称不能为空哦" placeholder="输入咨询师名称">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询师资质</span>
                        <!--<select name='qualification' class='layui-select rw30' style='display:block;'>-->
                        <!--<option value="0">无</option>-->
                        <!--{foreach $tag_list as $key=>$value}-->
                        <!--{if isset($vo.qualification) and $value.id == $vo.qualification}-->
                        <!--<option  value='{$value.id}' selected>{$value.name}</option>-->
                        <!--{else/}-->
                        <!--<option  value='{$value.id}'>{$value.name}</option>-->
                        <!--{/if}-->
                        <!--{/foreach}-->
                        <!--</select>-->
                        <input class="layui-input rw60" maxlength="200" required="required"  name="qualificationtext" value="{$vo.qualificationtext|default=''}" title="咨询师资质不能为空哦" placeholder="输入咨询师资质">

                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询师资质</span>
                        <div class="row nowrap">
                            <div class="col-xs-6">
                                <input type="hidden" name="qualificationphotos" id="qualificationphotos" value="{$vo.qualificationphotos|default=''}" data-srcs="{$vo.qualificationphotos|default=''}">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">所在城市</span>
                        <select required name='province_id' id="province_id" class='layui-select rw15'>
                        </select>
                        <select required name='city_id' id="city_id" class='layui-select rw15'>
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询费用</span>
                        <input class="layui-input rw20" maxlength="200" required="required"  name="price" value="{$vo.price|default=''}" title="咨询费用不能为空哦" placeholder="输入咨询费用">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">是否低价</span>
                        <div class="" style="height:auto">
                            <label class="think-checkbox">
                                <input type="radio" name="islow" value="1" {if isset($vo.islow)}{if condition=" $vo['islow']==1"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;是
                            </label>
                            <label class="think-checkbox">
                                <input type="radio" name="islow" value="0" {if isset($vo.islow)}{if condition=" $vo['islow']==1"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;否
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">费用说明</span>
                        <textarea class="layui-textarea rw60 rh20" name="priceintro" placeholder="请输入咨询师简介" required="required" title="请输入咨询师简介">{$vo.priceintro|default=""}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询方式</span>
                        <div class="" style="height:auto">
                            {foreach $psy_consult as $key=>$cate}
                            <label class="think-checkbox">
                                <input type="checkbox" name="type_ids[]" value="{$key}" {if isset($vo.type_ids)}{if condition="in_array($key, $vo['type_ids'])"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;{$cate}
                            </label>
                            {/foreach}
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">擅长类型</span>
                        <div class="" style="height:auto">
                            {foreach $tag_type_list as $key=>$cate}
                            <label class="think-checkbox">
                                <input type="checkbox" name="goodat_ids[]" value="{$key}" {if isset($vo.goodat_ids)}{if condition="in_array($key, $vo['goodat_ids'])"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;{$cate}
                            </label>
                            {/foreach}
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询时间段</span>
                        <div class="" style="height:auto">
                            {foreach $tags_time as $key=>$cate}
                            <label class="think-checkbox">
                                <input type="checkbox" name="period_ids[]" value="{$key}" {if isset($vo.period_ids)}{if condition="in_array($key, $vo['period_ids'])"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;{$cate}
                            </label>
                            {/foreach}
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询流派</span>
                        <div class="" style="height:auto">
                            {foreach $factions_list as $key=>$cate}
                            <label class="think-checkbox">
                                <input type="checkbox" name="factions_ids[]" value="{$key}" {if isset($vo.factions_ids)}{if condition="in_array($key, $vo['factions_ids'])"}checked{/if}{/if} style="margin-left: 0.6rem;"/>&nbsp;{$cate}
                            </label>
                            {/foreach}
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询师头像</span>

                        <div class="form-control" style="height:auto">
                            <div class="row nowrap">
                                <div class="col-xs-3" style="width:16rem;">
                                    <div class="upload-image-box" style="background-image: url('{$vo.avatar|default=$image}')">
                                        <input value="{$vo.avatar|default=''}" type="hidden" name="avatar">
                                    </div>
                                </div>
                                <div class="col-xs-6 rw44">
                                    <br>
                                    <a data-file="one" data-type="jpg,png,jpeg" data-field="avatar" class="btn btn-sm">上传图片</a>
                                </div>
                            </div>
                            <p class="help-block" style="margin-top:10px;color:#ccc;font-size: 12px;">图片建议尺寸：1:1</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">咨询师简介</span>
                        <textarea class="layui-textarea rw60 rh20" name="intro" placeholder="请输入咨询师简介" required="required" title="请输入咨询师简介">{$vo.intro|default=""}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">给来访者的话</span>
                        <textarea class="layui-textarea rw60 rh20" name="forviewer" placeholder="请输入咨询师简介" required="required" title="请输入咨询师简介">{$vo.forviewer|default=""}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <div class="input-group">
                        <span class="input-group-addon rw12">工作流程</span>
                        <textarea class="layui-textarea rw60 rh20" name="worktype" placeholder="请输入咨询师简介" required="required" title="请输入咨询师简介">{$vo.worktype|default=""}</textarea>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="layui-form-item text-center">
                        <button class="layui-btn" type='submit'>保存数据</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<!--右侧编辑区 结束-->

{/block}


{block name='script'}
<script>
    layui.use('form', function(){
        var form = layui.form;
        form.render();
    });

    var areas = JSON.parse('{$area_list|raw}');
    var selectIndexP = {$vo.province_id|default="0"};
    var selectIndexC = {$vo.city_id|default="0"};
    var selectIndexS = {$vo.district_id|default="0"};
    var selectP = 0;

    $(function () {
        $('body').on('change', '.upload-image-box input', function () {
            $('.news-item.active').css('background-image', 'url(' + this.value + ')');
            $(this).parent('.upload-image-box').css('background-image', 'url(' + this.value + ')');
        });
        $('#qualificationphotos').uploadMultipleImage();
        $('#province_id').change(function() {
            var id = $(this).children('option:selected').val();
            selectP = id;
            $("#city_id").empty();

            $.each(areas[id].city, function(idx, obj) {
                var selected = false;
                if (obj.id == selectIndexC) {
                    selected = true;
                }
                $("#city_id").append(new Option(obj.name, obj.id, false, selected));
            });

            $("#city_id").change();
        });

        // 城市选择开始
        $.each(areas, function(idx, obj) {
            var selected = false;
            if (idx == selectIndexP) {
                selected = true;
            }

            $("#province_id").append(new Option(obj.name, obj.id, false, selected));
            $("#province_id").change();
        });
    });

    function coordinateReciever(lat, lng) {
        $("#data_lat").val(lat);
        $("#data_lng").val(lng);
    }
</script>
{/block}

{block name="style"}
<style>
    .panel{border-radius:0}
    .article-right {position:absolute;left:20px;position:absolute;}
    .article-right .layui-input{border-radius:0;border:1px solid #e5e6e7;}
    .article-right .layui-input:hover, .news-right .layui-input:focus{border-color:#e5e6e7!important;}
    .article-right .input-group-addon{background:#fff;border-radius:0;border-color:#e5e6e7;text-align:right}
    .article-right .upload-image-box{width:10rem;height:10rem;background-size:cover;background-position:center center;}
</style>
{/block}